#include <iostream>
#include <vector>

using namespace std;

class Solution1 {
public:
    bool check(int num)
    {
        if (num < 2) return false;
        for (int i = 2; i <= num / i; ++i)
        {
            if (num % i == 0) return false;
        }
        return true;
    }

    int maximumPrimeDifference(vector<int>& nums) {
        int mn = -1; int mx = -1;
        int n = nums.size();
        for (int i = 0; i < n; ++i)
        {
            if (check(nums[i]))
            {
                if (mn == -1) mn = i;
                mx = i;
            }
        }
        return mx - mn;
    }
};

class Solution2 {
public:
    vector<vector<int>> modifiedMatrix(vector<vector<int>>& matrix) {
        int n = matrix.size(); int m = matrix[0].size();
        for (int j = 0; j < m; ++j)
        {
            int mx = -1;
            vector<int> index;
            for (int i = 0; i < n; ++i)
            {
                if (matrix[i][j] == -1) index.push_back(i);
                mx = max(matrix[i][j], mx);
            }
            for (int i : index)
                matrix[i][j] = mx;
        }
        return matrix;
    }
};

class Solution3 {
public:
    void duplicateZeros(vector<int>& arr) {
        int i = 0, j = 0, n = arr.size();
        while (j < n)
        {
            if (arr[i] == 0) ++j;
            ++i, ++j;
        }
        --i, --j;
        while (i >= 0)
        {
            if (j < n) arr[j] = arr[i];
            if (arr[i] == 0 && --j >= 0) arr[j] = 0;
            --i, --j;
        }
    }
};

class Solution4 {
public:
    long long countAlternatingSubarrays(vector<int>& nums) {
        long long ans = 1, s = 1;
        int n = nums.size();
        for (int i = 1; i < n; ++i)
        {
            s = nums[i] != nums[i - 1] ? s + 1 : 1;
            ans += s;
        }
        return ans;
    }
};

class Solution5 {
public:
    int dx[8] = { 1,-1,0,0,1,-1,1,-1 };
    int dy[8] = { 0,0,1,-1,1,1,-1,-1 };
    char c;

    bool dfs(vector<vector<char>>& board, int i, int j, int k)
    {
        int x = i + dx[k]; int y = j + dy[k];
        if (x < 0 || y < 0 || x >= 8 || y >= 8 || board[x][y] == '.') return false;
        if (board[x][y] == c) return true;
        return dfs(board, x, y, k);
    }

    bool checkMove(vector<vector<char>>& board, int rMove, int cMove, char color) {
        c = color;
        for (int k = 0; k < 8; ++k)
        {
            int x = rMove + dx[k]; int y = cMove + dy[k];
            if (x >= 0 && y >= 0 && x < 8 && y < 8 &&
                board[x][y] != '.' && board[x][y] != color)
                if (dfs(board, x, y, k))
                    return true;
        }
        return false;
    }
};


#include <string>

int main()
{
    string str;
    getline(cin, str);
    int cnt = 1; int n = str.size();
    string res;
    for (int i = 1; i < n; ++i)
    {
        if (str[i] == str[i - 1])
        {
            ++cnt;
        }
        else
        {
            if (cnt % 2)
            {
                if (str[i - 1] == res.back())
                    res.pop_back();
                else
                    res.push_back(str[i - 1]);
            }
            cnt = 1;
        }
    }
    if (cnt % 2)
    {
        if (str[n - 1] == res.back())
            res.pop_back();
        else
            res.push_back(str[n - 1]);
    }
    if (res.empty()) cout << 0;
    else cout << res;
    return 0;
}